import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BusinessMenuVO, BusinessMenuForm, BusinessMenuQuery } from '@/api/business/businessMenu/types';

/**
 * 查询商机填报系统菜单列表
 * @param query
 * @returns {*}
 */

export const listBusinessMenu = (query?: BusinessMenuQuery): AxiosPromise<BusinessMenuVO[]> => {
  return request({
    url: '/business/businessMenu/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询商机填报系统菜单详细
 * @param id
 */
export const getBusinessMenu = (id: string | number): AxiosPromise<BusinessMenuVO> => {
  return request({
    url: '/business/businessMenu/' + id,
    method: 'get'
  });
};

/**
 * 新增商机填报系统菜单
 * @param data
 */
export const addBusinessMenu = (data: BusinessMenuForm) => {
  return request({
    url: '/business/businessMenu',
    method: 'put',
    data: data
  });
};

/**
 * 修改商机填报系统菜单
 * @param data
 */
export const updateBusinessMenu = (data: BusinessMenuForm) => {
  return request({
    url: '/business/businessMenu',
    method: 'put',
    data: data
  });
};

/**
 * 删除商机填报系统菜单
 * @param id
 */
export const delBusinessMenu = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/businessMenu/' + id,
    method: 'delete'
  });
};
